* load World Bank historical income categories (low, lower mid, upper mid)
* 		https://datahelpdesk.worldbank.org/knowledgebase/articles/378834-how-does-the-world-bank-classify-countries 
* spreadsheet from http://databank.worldbank.org/data/download/site-content/OGHIST.xls

cd "~/Documents/econ/research/current/cognitive/estimation/data"

import excel using WB_inc_categories.xlsx, clear
sxpose, clear
drop in 1
gen year = real(_var1)
gen int low_inc = real(subinstr(substr(_var2,4,.),",","",1))
gen int low_mid = real(subinstr(substr(_var3,strpos(_var3,"-")+1,.),",","",1))
gen int up_mid = real(subinstr(substr(_var4,strpos(_var4,"-")+1,.),",","",1))

label var low_inc "Max GNIpc for W.B. Low Income category"
label var low_mid "Max GNIpc for W.B. Lower Middle Income category"
label var up_mid  "Max GNIpc for W.B. Upper Middle Income category"

keep year low_inc low_mid up_mid
compress
sort year
saveold WB_inc_cat, replace version(11)
